
import Home from '../view/Home'
import News from '../view/News'

const Main = (props) => {
    //接受一个表示,控制显示哪个组件
    return <main>
        <div style={{ display: props.active === 0 ? 'block' : 'none' }}>
            <Home></Home>
        </div>
        <div style={{ display: props.active === 1 ? 'block' : 'none' }}>
            <News></News>
        </div>

    </main>
}
Main.defaultProps = {
    active: 0
}
export default Main

